package com.suning.sawp.dto.esb;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.thoughtworks.xstream.annotations.XStreamAlias;

@XStreamAlias("MbfBody")
public class LogisticsQueryReq implements Serializable {

    /**
     */
    private static final long serialVersionUID = -6201101499260051405L;

    /**
     * 非空字段<br>
     * A：物流明细查询<br>
     * B：退货查询 <br>
     * C：换货查询<br>
     * D：揽件查询<br>
     */
    @XStreamAlias("operateType")
    private final String operateType;

    /**
     * 快递单号
     */
    @XStreamAlias("trackingNumber")
    private final String trackingNumber;

    /**
     * 非空字段<br>
     * 系统来源：SNSAWP<br>
     */
    @XStreamAlias("oriSystem")
    private final String oriSystem;

    /**
     * OMS订单行号
     */
    @XStreamAlias("orderItemId")
    private final String orderItemId;

    /**
     * POS订单号（用于历史订单）
     */
    @XStreamAlias("posOrder")
    private final String posOrder;

    /**
     * 门店号（用于历史订单）
     */
    @XStreamAlias("storeCode")
    private final String storeCode;

    /**
     * SAP订单号
     */
    @XStreamAlias("orderType")
    private final String orderType;

    /**
     * 订单销售日期（用于历史订单），格式为YYYYMMDD
     */
    @XStreamAlias("orderDate")
    private final String orderDate;

    /**
     * SAP订单类型（用于历史订单）
     */
    @XStreamAlias("sapOrderId")
    private final String sapOrderId;

    public LogisticsQueryReq(final String operateType, final String trackingNumber, final String oriSystem,
            final String orderItemId, final String posOrder, final String storeCode, final String orderType,
            final String orderDate, final String sapOrderId) {
        super();
        this.operateType = operateType;
        this.trackingNumber = trackingNumber;
        this.oriSystem = oriSystem;
        this.orderItemId = orderItemId;
        this.posOrder = posOrder;
        this.storeCode = storeCode;
        this.orderType = orderType;
        this.orderDate = orderDate;
        this.sapOrderId = sapOrderId;
    }

    public static class Builder {

        private String operateType;

        private String trackingNumber;

        private String oriSystem;

        private String posOrder;

        private String orderItemId;

        private String storeCode;

        private String orderType;

        private String orderDate;

        private String sapOrderId;

        public Builder operateType(String operateType) {
            this.operateType = operateType;
            return this;
        }

        public Builder trackingNumber(String trackingNumber) {
            this.trackingNumber = trackingNumber;
            return this;
        }

        public Builder oriSystem(String oriSystem) {
            this.oriSystem = oriSystem;
            return this;
        }

        public Builder posOrder(String posOrder) {
            this.posOrder = posOrder;
            return this;
        }

        public Builder orderItemId(String orderItemId) {
            this.orderItemId = orderItemId;
            return this;
        }

        public Builder storeCode(String storeCode) {
            this.storeCode = storeCode;
            return this;
        }

        public Builder orderType(String orderType) {
            this.orderType = orderType;
            return this;
        }

        public Builder orderDate(String orderDate) {
            this.orderDate = orderDate;
            return this;
        }

        public Builder sapOrderId(String sapOrderId) {
            this.sapOrderId = sapOrderId;
            return this;
        }

        public LogisticsQueryReq create() {
            return new LogisticsQueryReq(operateType, trackingNumber, oriSystem, orderItemId, posOrder, storeCode,
                    orderType, orderDate, sapOrderId);
        }
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
